package de.clapp.menucard;

import android.os.Bundle;
import android.support.v4.app.ListFragment;

public class MenucardItemlist extends ListFragment
{

    private MenucardItemAdapter adapter;

    private String categorieName;

    @Override
    public void onResume()
    {
        super.onResume();
        Bundle bundle = getArguments();
        if(bundle != null && bundle.containsKey("KATEGORIE"))
        {
            categorieName = bundle.getString("KATEGORIE");
        }
        adapter = new MenucardItemAdapter(this, categorieName);
        setListAdapter(adapter);
        setListShown(false);
        MenucardModel.getInstance().addListener(adapter);

    }

    @Override
    public void onPause()
    {
        MenucardModel.getInstance().removeListener(adapter);
        adapter = null;
        super.onPause();
    }
}
